package ab.mes.service.impl;

import ab.mes.entity.Equipment;
import ab.mes.mapper.EquipmentMapper;
import ab.mes.service.EquipmentService;
import ab.mes.tools.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EquipmentServiceImpl implements EquipmentService {
    @Autowired
    private EquipmentMapper equipmentMapper;
    //获取设备信息
    public Result getEquipment(){
        Result result = new Result();
        result.getMap().put("equipment",equipmentMapper.selectEquipment1());
        return result;
    }
    public Result getEquipmentByNumber(Integer id_Of_Equipment){
        Result result = new Result();
        result.getMap().put("equipment",equipmentMapper.selectByNumber(id_Of_Equipment));
        return result;
    }
    //新增物料信息
    public Result insertEquipment(Equipment equipment) {
        Result result = new Result();
        result.getMap().put("equipment",equipmentMapper.insertEquipment(equipment));
        return result;
    }
    //根据id删除物料信息
    public Result deleteEquipment(Integer id_Of_Equipment) {
        Result result = new Result();
        result.getMap().put("equipment", equipmentMapper.deleteEquipment(id_Of_Equipment));
        return result;
    }
    //修改物料信息
    public Result editEquipment(Equipment equipment){
        Result result = new Result();
        result.getMap().put("equipment",equipmentMapper.editEquipment(equipment));
        return result;
    }

    //模糊查询功能
    public Result searchEquipment(String keyWord){
        Result result = new Result();
        result.getMap().put("equipment",equipmentMapper.searchEquipment(keyWord));
        return result;
    }
}
